安装latex并在Vscode中使用

您所在的位置:网站首页 windows photo viewer无法读取pdf文件 安装latex并在Vscode中使用

安装latex并在Vscode中使用

2023-03-20 23:22| 来源: 网络整理| 查看: 265

下载和安装 从清华源下载

https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/Images/

从网页下载“textlive2022.iso”

清华大学开源软件 得到: 下载文件 双击得到: iso镜像里面的文件双击Install-tl-windows.bat文件,点击修改选择安装的位置。(我已经安装好了,就直接用教程的图了),千万不要点abort(这是终止的意思) 在这里插入图片描述

安装完成后,获得欢迎进入TexLive的世界。 在这里插入图片描述 检查安装是否正常:按win + R 打开运行,输入cmd,打开命令行窗口;然后输入命令xelatex -v ,如下图 在这里插入图片描述 在CMD中输入 texdoc lshort-zh-cn,会打开文件“lsgrt-zh-cn.pdf”文件

在这里插入图片描述 在这里插入图片描述

vscode 配置 安装vscode 扩展,

点击左侧图标,先安装chinese显示中文的,然后安装Latex Workshop。 在这里插入图片描述在这里插入图片描述

打开LaTeX环境设置页面

点击下图中的按钮,进入设置json中 在这里插入图片描述

{ //------------------------------LaTeX 配置---------------------------------- // 设置是否自动编译 "latex-workshop.latex.autoBuild.run":"never", //右键菜单 "latex-workshop.showContextMenu":true, //从使用的包中自动补全命令和环境 "latex-workshop.intellisense.package.enabled": true, //编译出错时设置是否弹出气泡设置 "latex-workshop.message.error.show": false, "latex-workshop.message.warning.show": false, // 编译工具和命令 "latex-workshop.latex.tools": [ { "name": "xelatex", "command": "xelatex", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "%DOCFILE%" ] }, { "name": "pdflatex", "command": "pdflatex", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "%DOCFILE%" ] }, { "name": "latexmk", "command": "latexmk", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-pdf", "-outdir=%OUTDIR%", "%DOCFILE%" ] }, { "name": "bibtex", "command": "bibtex", "args": [ "%DOCFILE%" ] } ], // 用于配置编译链 "latex-workshop.latex.recipes": [ { "name": "XeLaTeX", "tools": [ "xelatex" ] }, { "name": "PDFLaTeX", "tools": [ "pdflatex" ] }, { "name": "BibTeX", "tools": [ "bibtex" ] }, { "name": "LaTeXmk", "tools": [ "latexmk" ] }, { "name": "xelatex -> bibtex -> xelatex*2", "tools": [ "xelatex", "bibtex", "xelatex", "xelatex" ] }, { "name": "pdflatex -> bibtex -> pdflatex*2", "tools": [ "pdflatex", "bibtex", "pdflatex", "pdflatex" ] } ], //文件清理。此属性必须是字符串数组 "latex-workshop.latex.clean.fileTypes": [ "*.aux", "*.bbl", "*.blg", "*.idx", "*.ind", "*.lof", "*.lot", "*.out", "*.toc", "*.acn", "*.acr", "*.alg", "*.glg", "*.glo", "*.gls", "*.ist", "*.fls", "*.log", "*.fdb_latexmk" ], //设置为onFaild 在构建失败后清除辅助文件 "latex-workshop.latex.autoClean.run": "onFailed", // 使用上次的recipe编译组合 "latex-workshop.latex.recipe.default": "lastUsed", // 用于反向同步的内部查看器的键绑定。ctrl/cmd +点击(默认)或双击 "latex-workshop.view.pdf.internal.synctex.keybinding": "double-click", //使用 SumatraPDF 预览编译好的PDF文件 // 设置VScode内部查看生成的pdf文件 "latex-workshop.view.pdf.viewer": "external", // PDF查看器用于在\ref上的[View on PDF]链接 "latex-workshop.view.pdf.ref.viewer":"auto", // 使用外部查看器时要执行的命令。此功能不受官方支持。 "latex-workshop.view.pdf.external.viewer.command": "F:/SumatraPDF/SumatraPDF.exe", // 注意修改路径 // 使用外部查看器时,latex-workshop.view.pdf.external.view .command的参数。此功能不受官方支持。%PDF%是用于生成PDF文件的绝对路径的占位符。 "latex-workshop.view.pdf.external.viewer.args": [ "%PDF%" ], // 将synctex转发到外部查看器时要执行的命令。此功能不受官方支持。 "latex-workshop.view.pdf.external.synctex.command": "F:/SumatraPDF/SumatraPDF.exe", // 注意修改路径 // latex-workshop.view.pdf.external.synctex的参数。当同步到外部查看器时。%LINE%是行号,%PDF%是生成PDF文件的绝对路径的占位符,%TEX%是触发syncTeX的扩展名为.tex的LaTeX文件路径。 "latex-workshop.view.pdf.external.synctex.args": [ "-forward-search", "%TEX%", "%LINE%", "-reuse-instance", "-inverse-search", "\"F:/Microsoft VS Code/Code.exe\" \"F:/Microsoft VS Code/resources/app/out/cli.js\" -r -g \"%f:%l\"", // 注意修改路径 "%PDF%" ] }

配置设置来自:https://zhuanlan.zhihu.com/p/166523064,写的很详细,可以再看看

教程:

TeX Live 2022 安装指南【安装 LaTeX】 https://zhuanlan.zhihu.com/p/493412905Visual Studio Code (vscode)配置LaTeX https://zhuanlan.zhihu.com/p/166523064


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3